package com.hqd.ch03.v50.boot.web.servlet;

import com.hqd.ch03.v50.boot.autoconfigure.web.servlet.ServletRegistrationBean;

import javax.servlet.Filter;

public class FilterRegistrationBean<T extends Filter> extends AbstractFilterRegistrationBean<T> {

    private T filter;

    /**
     * Create a new {@link FilterRegistrationBean} instance.
     */
    public FilterRegistrationBean() {
    }

    /**
     * Create a new {@link FilterRegistrationBean} instance to be registered with the
     * specified {@link ServletRegistrationBean}s.
     *
     * @param filter                   the filter to register
     * @param servletRegistrationBeans associate {@link ServletRegistrationBean}s
     */
    public FilterRegistrationBean(T filter, ServletRegistrationBean<?>... servletRegistrationBeans) {
        super(servletRegistrationBeans);
        this.filter = filter;
    }

    @Override
    public T getFilter() {
        return this.filter;
    }

    /**
     * Set the filter to be registered.
     *
     * @param filter the filter
     */
    public void setFilter(T filter) {
        this.filter = filter;
    }

}
